//
//  LeftDrawerTableViewController.m
//  MMDrawerexercise01
//
//  Created by students on 16/3/29.
//  Copyright © 2016年 ZL. All rights reserved.
//

#import "LeftDrawerTableViewController.h"
#import "BoutiqueCollectionViewController.h"
#import "UIViewController+MMDrawerController.h"

@interface LeftDrawerTableViewController ()

@end

@implementation LeftDrawerTableViewController
{
    NSMutableArray *_dataSource;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    _dataSource=[[NSMutableArray alloc]initWithObjects:@"返回",@"动画返回", nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return _dataSource.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *cellId =@"cellId";
    UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
        cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    cell.textLabel.text =_dataSource[indexPath.row];
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewFlowLayout *layout =[[UICollectionViewFlowLayout alloc]init];
    BoutiqueCollectionViewController *center =[[BoutiqueCollectionViewController alloc]initWithCollectionViewLayout:layout];
    center.collectionView.backgroundColor =[UIColor whiteColor];
    UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:center];
    if (indexPath.row%2 ==0) {
        [self.mm_drawerController setCenterViewController:nav withCloseAnimation:YES completion:nil];
    }else{
        [self.mm_drawerController setCenterViewController:nav withFullCloseAnimation:YES completion:nil];
    }
}


@end
